/**
 * Created by yuyongzhen  <1640599564@qq.com>>.
 */

module.exports = function(mod,name){
	mod.controller(name,['$scope','$routeParams','$location','dashboardFetchDetail',function($scope,$routeParams,$location,dashboardFetchDetail){
		$scope.provinces = null;
		$scope.cateories = null;
		function fillData(pageno,pro,cate){
			dashboardFetchDetail.getDetail(pageno,pro,cate).then(function(ret){	
				if(ret.status == 200){
					if(ret.data.status){
						$scope.detail = ret.data.data.detail;
						$scope.totalCounts = ret.data.data.totalCounts;
						$scope.pageSize = ret.data.data.pageSize;
						$scope.pageno = $routeParams.pageno;

						$scope.url = '#/dashboard/fetchdetail/pageno/'+$routeParams.pro+'/'+$routeParams.cate;
					}
					$scope.provinces = ret.data.ext.provinces;
					$scope.categories = ret.data.ext.categories;
					$scope.curPro = $routeParams.pro;
					$scope.curCate = $routeParams.cate;
				}
			});
		}
		fillData($routeParams.pageno,$routeParams.pro,$routeParams.cate);
	}]);
}

